using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class BackHome : MonoBehaviour
{
    public Button BackhomeButton;
    public Button RestartButton;
    void Start()
    {
        //清除学生列表
        StudentManager studentManager = FindObjectOfType<StudentManager>();
        if (studentManager != null)
        {
            studentManager.ClearAllStudents();
        }
        else
        {
            Debug.LogWarning("未找到 StudentManager，无法清除学生列表。");
        }
        //添加监听
        BackhomeButton.onClick.AddListener(() =>
        {
            //跳转场景
            UnityEngine.SceneManagement.SceneManager.LoadScene("Start");
            
        });
        
        RestartButton.onClick.AddListener(() =>
        {
            PlayerPrefs.SetString(GameMode.RestartType,GameMode.Single);
            //TODO模式场景
            //跳转场景
            UnityEngine.SceneManagement.SceneManager.LoadScene("Start");
            
        });
    }


}
